<?php
/**
 * Created by PhpStorm.
 * User: ai
 * Date: 2017/12/4
 * Time: 15:15
 */
use kartik\detail\DetailView;
use yii\widgets\Pjax;
use yii\helpers\Url;

//Pjax::begin(['id' => 'transfer_form']);
echo DetailView::widget([
    'model' => $transferModel,
    'condensed' => true,
    'hover' => true,
    'mode' => 'view',
    'panel' => [
        'heading' => '转让信息',
        'headingOptions' => ['template' => '{title}'],
        'type' => DetailView::TYPE_INFO,
        'footer' => '<span class="glyphicon glyphicon-pencil"></span>',
        'footerOptions' => ['class' => 'panel-heading', 'tag' => 'h4', 'template' => '{buttons}{title}']
    ],
    'formOptions' => ['options' => ['data-pjax' => true], 'method' => 'post', 'action' => $transferModel->id ? Url::to(['package-ease-transfer/update', 'id' => $transferModel->id]) : Url::to(['package-ease-transfer/create', 'package_id' => $model->id])],
    'hideIfEmpty' => false,//如果有空字段则隐藏
    'buttons1' => '{update}',
    'buttons2' => '{view} {reset} {save}',
    'updateOptions' => ['label' => '<span class="btn btn-info">编辑</span>'],
    'viewOptions' => ['label' => '<span class="btn btn-info">查看</span>'],
    'saveOptions' => ['label' => ($model->owner == Yii::$app->user->id || in_array(Yii::$app->user->identity->realname, Yii::$app->params['package_ease_personal'])) ? '<span class="btn btn-info">保存</span>' : ''],
    'resetOptions' => ['label' => '<span class="btn btn-info">重置</span>'],
    'attributes' => [
        ['attribute' => 'method', 'type' => 'radioList', 'items' => Yii::$app->params['transfer_method'], 'value' => Yii::$app->params['transfer_method'][$transferModel->method]],
        'wish', 'detail:decimal',
        'evaluate_transfer_date',
        ['attribute' => 'transfer', 'type' => 'radioList', 'items' => Yii::$app->params['package_ease_transfer'], 'value' => Yii::$app->params['package_ease_transfer'][$transferModel->transfer]],
//        'transfer_title',
        ['columns' => [['attribute' => 'contact', 'valueColOptions' => ['style' => 'width:30%']], 'position',]],
        ['columns' => [['attribute' => 'phone', 'valueColOptions' => ['style' => 'width:30%']], 'email',]],
        'address',
        [
            'attribute' => 'remark',
            'options' => ['placeholder' => '对本资产包的影响力；居间费用；竞争对手说明；合作模式及其他沟通情况']
        ],
    ],
]);
//Pjax::end();